<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>vue</title>
		<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
		<style>
			img {
				height: 200px;
			}
		</style>
	</head>
	<body>
		<div id="app">
			不保留小数：{{"￥"+price}}
			<br>
			保留两位小数：{{price|fixed("￥",2)}}
			<br>
			保留三位小数：{{price|fixed("￥",3)}}
			<br>
			保留四位小数：{{price|fixed("￥",4)}}
		</div>

		<script>
			new Vue({
				el: '#app',
				data() {
					return {
						price: 1999
					}
				},
				filters: {
					fixed(data, str, n) {
						return str + data.toFixed(n)
					}
				}
			})
		</script>
	</body>
</html>
